<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
    <style type="text/css">
       .inputPassword{
          height:20px;
		  width:140px;
		  vertical-align:middle;
		  line-height:20px;
		  border:#cbcbcb solid 1px;
       }
    </style>
	<script type="text/javascript">
	 $(document).ready(function(){
		//增加隔行变色效果
   	    $(".listtable").zebra();
		//加载用户角色
		$('#framework_roleid').combobox({
			url:'${pageContext.request.contextPath}/systemManagerAction!loadComboxData.action',  
			valueField:'roleid',
			textField:'rolename',
	 	 	editable:false,
	 	 	required:true,
			onLoadSuccess:function(){
				//不让第一条为默认选择项
				$('#framework_roleid').combobox('unselect',0);
			}
		});
		 //加载所有部门数据
		 $('#framework_department_deptId').combotree({
			url:'${pageContext.request.contextPath}/systemManagerAction!getEtlDepartmentData.action?status=1',
			parentField : 'pid',
  			lines : true,
  			required: true,
  			onSelect:function(data){
  				if(data.id!="parent"){
  					$("#framework_department_deptId").val(data.id);
  				}else{
  					$('#framework_department_deptId').combotree('clear');
  				}
  				
  			}
 	 	 });
	 });
	 //切换用户性别        男：1;女：2
     function changeBoyOrGirlRadio(idx){
    	 if(idx==1){
    		 $("#framework_boy").attr("checked",true);
    		 $("#framework_girl").attr("checked",false);
    	 }else{
    		 $("#framework_boy").attr("checked",false);
    		 $("#framework_girl").attr("checked",true);
    	 }
     }
	 function validateData(){
		 var userpwd=$("#framework_userpwd").val();
		 var confirmuserpwd=$("#framework_confirmuserpwd").val();
		 if(userpwd!=confirmuserpwd){
			 $.messager.alert("操作提示","两次密码不匹配");
			 return;
		 }else{
			 return true;
		 }
	 }
	 //验证用户是否存在
	 function validataUserId(){
		 var userid=$("#framework_userid").val();
		 var patrn=/^[u4E00-u9FA5]+$/;
		 if(""!=userid && userid.length>0){
			 $.ajax({
				 url :'${pageContext.request.contextPath}/systemManagerAction!validataUserId.action',
				 data:{"userid":userid},
				 dataType :'json',
				 cache : true,
				 success : function(data){
					if(data.returnFlag){
						$("#framework_userid").css({"border":"#b8251b solid 1px","color":"#b8251b","font-size":"13px"});
						$.messager.show({
							title : '操作提示',
							msg : data.returnMsg,
							showType:'slide'
						});
					}else{
						$("#framework_userid").css({"border":"#95b8e7 solid 1px","color":"","font-size":""});
					}
				 }
		     });
		 }
	 }
	</script>
    <!-- 新建用户用户 -->
  <form id="framework_user_addform" method="post" >
     <table border="0" cellpadding="0" cellspacing="0" height="100%"  width="100%" class="listtable"> 
		<tr>
		    <td height="40px" style="text-align:right" nowrap="nowrap"><span style="color:red;font-size:15px">*</span>账号：&nbsp;</td>
			<td height="28px;" width="140px">
				<input  onblur="validataUserId()"   id="framework_userid" type="text" name="userid"  maxlength="20"  class="easyui-validatebox" validType='chinese("framework_userid")' data-options="required:true,missingMessage:'用户账号必须填写'"/>
			</td>
			<td height="40px" style="text-align:right;" nowrap="nowrap"><span style="color:red;font-size:15px">*</span>姓名：&nbsp;</td>
			<td height="28px;" width="140px" style="text-align:left;">
				<input id="framework_username" type="text" name="username"  panelHeight="auto" class="easyui-validatebox" data-options="required:true,missingMessage:'用户名称必须填写'" style="margin-right:23px"/>
			</td>
		</tr>
		<tr>
			<td height="40px" style="text-align:right" nowrap="nowrap"><span style="color:red;font-size:15px">*</span>手机号码：&nbsp;</td>
			<td height="40px">
				<input id="framework_phonenum" type="text" name="phonenum" class="easyui-numberbox" validType='mobile("framework_phonenum")' data-options="required:true,missingMessage:'只能输入数字'" />
			</td>
			<td height="40px" style="text-align:right" nowrap="nowrap"><span style="color:red;font-size:15px">*</span>角色：&nbsp;</td>
			<td height="40px" style="text-align:left;">
				<input id="framework_roleid" type="text" name="roleid"     panelHeight="auto" style="width:160px" data-options="required:true,missingMessage:'用户角色不能为空'"/>
			</td>
		</tr>
		<tr>
			<td height="40px" style="text-align:right" nowrap="nowrap"><span style="color:red;font-size:15px">*</span>密码：&nbsp;</td>
			<td height="40px">
				<input id="framework_userpwd" type="password" name="userpwd"  class="easyui-validatebox" data-options="required:true,missingMessage:'用户密码必须填写'"/>
			</td>
			<td height="40px" style="text-align:right" nowrap="nowrap"><span style="color:red;font-size:15px">*</span>确认密码：&nbsp;</td>
			<td height="40px" style="text-align:left;">
				<input id="framework_confirmuserpwd" type="password" name="confirmuserpwd"  class="easyui-validatebox" data-options="required:true,missingMessage:'用户密码必须填写'"/>
			</td>
		</tr>
		<tr>
			<td height="40px" style="text-align:right" nowrap="nowrap"><span style="color:red;font-size:15px">*</span>部门：&nbsp;</td>
			<td height="40px">
				<input id="framework_department_deptId" type="text" name="deptId"  data-options="required:true,missingMessage:'用户部门不能为空'"/>
			</td>
			<td height="40px" style="text-align:right" nowrap="nowrap"><span style="color:red;font-size:15px">*</span>电子邮箱：&nbsp;</td>
			<td height="40px" style="text-align:left;">
				<input id="framework_email" type="text" name="email"   style="width:160px" class="easyui-validatebox" data-options="required:true,validType:'email'"/>
			</td>
		</tr>
		<tr>
			<td height="40px" style="text-align:right" nowrap="nowrap"><span style="color:red;font-size:15px">*</span>性别：&nbsp;</td>
			<td height="40px">
				<input id="framework_boy"  type="radio" name="framework_boy"   style="margin-left:20px;"  value="1" checked="checked"  onclick="changeBoyOrGirlRadio(1)"/>男
				<input id="framework_girl" type="radio" name="framework_girl"  style="margin-left:20px" value="2"  onclick="changeBoyOrGirlRadio(2)"/> 女
			</td>
			<td height="40px" style="text-align:right" nowrap="nowrap"></td>
			<td height="40px" style="text-align:left;">
			</td>
		</tr>
		<tr>
			<td height="40px" style="text-align:right" nowrap="nowrap">自我简介：&nbsp;</td>
			<td height="68px" colspan="3">
				<textarea id="framework_userdetailinfo" name="userdetailinfo" class="easyui-validatebox" data-options="required:false,validType:'length[0,60]'" style="width:436px;height:60px;"></textarea>
			</td>
		</tr>
		<tr>
			<td height="40px" style="text-align:right" nowrap="nowrap">个性签名：&nbsp;</td>
			<td height="68px" colspan="3">
				<textarea id="framework_signatureinfo" name="signatureinfo" class="easyui-validatebox" data-options="required:false,validType:'length[0,60]'" style="width:436px;height:60px;"></textarea>
			</td>
		</tr>
     </table>
   </form>